#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>

struct TreeNode 
{
    int val;
    struct TreeNode *left;
    struct TreeNode *right;
};
 

void preorder(struct TreeNode* root, int* res, int* resSize)
{
    if (root == NULL)
    {
        return;
    }
    preorder(root->left, res, resSize);
    res[(*resSize)++] = root->val;
    preorder(root->right, res, resSize);
}

int* inorderTraversal(struct TreeNode* root, int* returnSize)
{
    int* res = (int*)malloc(sizeof(int) * 2000);
    *returnSize = 0;
    preorder(root, res, returnSize);
    return res;
}